package com.chizha.iot.mqtt.server;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class MessageHandleService {

	public void saveRawData(String table, String messageType, String topicName, String upData, String downData){
		Db.save(table, new Record().set("messageType", messageType).set("topicName", topicName).set("down_data", downData)); //.set("up_data", upData)
	}
	
	public Record findTask(String terminal_id){
		String sql = "select * from terminal where terminal_id = '"+terminal_id+"' ";
		return Db.find(sql).get(0);
	}
	
	public void savePicPath(String terminal_id, String pic_url){
		Db.save("pic_path", new Record().set("terminal_id", terminal_id).set("pic_url", pic_url));
	}
	

}
